package com.ztstkj.lzservices.utils

object HexUtil {
    fun toHexStr(byteArray: ByteArray,splitString: String="") = with(StringBuilder()) {
        byteArray.forEach {
            val hex = it.toInt() and (0xFF)
            val hexStr = Integer.toHexString(hex).uppercase()
            if (hexStr.length == 1) append("0").append(hexStr).append(splitString)
            else append(hexStr).append(splitString)
        }
        toString().trimEnd()
    }
}